package org.itstec.order.controller;

import org.itstec.common.result.R;
import org.itstec.common.security.CryptoDecryptionSignSecurity;
import org.itstec.order.entify.Order;
import org.itstec.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @CryptoDecryptionSignSecurity
    @PostMapping(value = "/create")
    public R<?> create(Order order){
        return orderService.create(order);
    }

    @PostMapping(value = "/getById")
    public R<?> getById(Order order){
        return orderService.get(order);
    }

    @PostMapping(value = "/copyOrder")
    public R<?> copy(long orderId, int copiesNum){
        return orderService.copy(orderId,copiesNum);
    }
    
}
